//
//  DRFoodCell.m
//  DoctorRen
//
//  Created by Lemon on 2018/11/19.
//

#import "DRFoodCell.h"
#import "DRFoodPairingModel.h"

@interface DRFoodCell()
@property (weak, nonatomic) IBOutlet UIImageView *foodImageView;
@property (weak, nonatomic) IBOutlet UILabel *foodNameLB;
@property (weak, nonatomic) IBOutlet UILabel *quantityLB;
@property (weak, nonatomic) IBOutlet UILabel *tagLB;
@property (weak, nonatomic) IBOutlet UIButton *optionalBtn;
@property (weak, nonatomic) IBOutlet UILabel *foodTypeName;

@end

@implementation DRFoodCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.optionalBtn.layer.cornerRadius = 12;
    self.optionalBtn.layer.masksToBounds = YES;
    self.foodImageView.layer.cornerRadius = 4;
    self.foodImageView.layer.masksToBounds = YES;
}

-(void)setFoodData:(DRFoodMode *)data{
    [self.foodImageView setImageWithURLString:data.path];
    self.foodNameLB.text = data.title;
    self.quantityLB.text = data.energy;
    self.tagLB.text = [NSString stringWithFormat:@"(%@)",data.unit];
    self.foodTypeName.text = data.ch_lang;
    
}
- (IBAction)clickChangeBtn:(id)sender {
    if (self.reloadAction) {
        self.reloadAction();
    }
}
- (IBAction)clickOptionalBtn:(id)sender {
    if (self.optionalAction) {
        self.optionalAction();
    }
}

@end
